package StudyCode.summary.myfile;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeleteTemporaryDirectoryWithDeleteOnExit {
	public static void main(String[] args) {
		Path basedir = FileSystems.getDefault().getPath("E:/Copy/");
		String tmp_dir_prefix = "test_";
		try {
			Path tmp_dir = Files.createTempDirectory(basedir, tmp_dir_prefix);
			File asFile = tmp_dir.toFile();
			asFile.deleteOnExit();
			Thread.sleep(1000);
		} catch (IOException | InterruptedException e) {
			System.err.println(e);
		}
	}
}
